package com.schoolvisitors.repository;

import com.schoolvisitors.entity.Admin;
import com.schoolvisitors.entity.Role;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface AdminRepository extends JpaRepository<Admin, Long> {
    Optional<Admin> findByUsername(String username);

    Admin findByUsernameAndPassword(String username, String password);

    List<Admin> findAllByReviewer(boolean b);

    boolean existsAdminByRole(Role role);

    boolean existsAdminByRoleAndDeleteFalse(Role role);

    List<Admin> findAllByDeleteFalse();

    Optional<Admin> findByUsernameAndDeleteFalse(String username);

    Optional<Admin> findByIdAndDeleteFalse(Long id);

    List<Admin> findAllByReviewerAndDeleteFalse(Boolean reviewer);
}
